package bal.android.clube;

import bal.android.R;
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;

public class SelClubeActivity extends ListActivity {

	public static final String[] CLUBES = { "Palmeiras", "Vasco", "Corinthians", "Internacional" };
	
	private ListView lv;

	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		String[] clubes = CLUBES;
		setListAdapter(new ArrayAdapter<String>(this, R.layout.selecionar_clube, clubes));

		lv = getListView();
		lv.setTextFilterEnabled(true);

		lv.setOnItemClickListener(new OnItemClickListener() {
			public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
				detalhesClube((String) lv.getItemAtPosition(position));
			}
		});
	}

	private void detalhesClube(String clube) {
		Intent intent = new Intent(this, SelClube2Activity.class);
		intent.putExtra("clube", clube);
		startActivity(intent);
		this.finish();
	}
}